﻿using System.Windows.Forms;

/// <summary>
/// 退出确认对话框
/// </summary>
internal class ExitConfirmDlg : Form
{
    public ExitConfirmDlg()
    {
        Text = "选择操作";
        FormBorderStyle = FormBorderStyle.FixedDialog;
        MaximizeBox = MinimizeBox = false;
        StartPosition = FormStartPosition.CenterParent;
        Width = 250;
        Height = 160;

        Controls.Add(new Label
        {
            Text = "结束任务：只关此守护程序，不关服务器",
            Left = 10,
            Top = 12,
            AutoSize = true,
            ForeColor = System.Drawing.Color.Red
        });

        Controls.Add(new Label
        {
            Text = "后台运行：将隐藏所有服务器窗口",
            Left = 10,
            Top = 30,
            AutoSize = true,
            ForeColor = System.Drawing.Color.Red
        });

        Button btnClose = new Button { Text = "结束任务", Left = 12, Top = 60, Width = 100 };
        Button btnBack = new Button { Text = "后台运行", Left = 122, Top = 60, Width = 100 };
        Button btnCancel = new Button { Text = "取消", Left = 82, Top = 90, Width = 80 };

        Controls.AddRange(new Control[] { btnClose, btnBack, btnCancel });

        btnClose.Click += (s, e) => { DialogResult = DialogResult.Yes; Close(); };
        btnBack.Click += (s, e) => { DialogResult = DialogResult.No; Close(); };
        btnCancel.Click += (s, e) => { DialogResult = DialogResult.Cancel; Close(); };

        this.CancelButton = btnCancel;
    }
}